package cch.android.offinemaps.maps.tools;

import android.os.Handler;
import android.os.Message;
import android.util.Log;
import cch.android.offinemaps.maps.RawTile;
import cch.android.offinemaps.maps.loader.BaseLoader;
import cch.android.offinemaps.maps.providers.MapStrategy;

public class MapFlowNotify {
	private int totalByte = 0;
	
	private Handler handler;

	public MapFlowNotify(Handler handler) {
		this.handler = handler;
	}
	public void handle(byte[] data, int meta) {
		Log.i("", "下载图片流量测试一");
		if(data!=null&&data.length>0)
			totalByte += data.length;
		Message msg = new Message();
		msg.what = meta;
		msg.arg1 = getTotalKB();
		if(handler!=null)
		handler.sendMessage(msg);
	}
	public int getTotalMB() {
		return totalByte / (1024*1024);
	}
	public int getTotalKB() {
		return totalByte / 1024;
	}
	
}